﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server"><title>ProductClass</title>
	<script type="text/javascript" src="../../Scripts/jquery-1.4.1.min.js"></script>
	<script type="text/javascript" src="../../Scripts/jquery.jbind.js"></script>
	<script type="text/javascript" src="../../Scripts/jquery.treeTable.js"> </script>
	<script src="../../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../Scripts/jquery.FixedHeadTable.js"> </script>
	<link href="../../Content/jquery.treeTable.css" rel="stylesheet" type="text/css" />
	<link href="../../Content/easyui.css" rel="stylesheet" type="text/css" />
	<style type="text/css">
		ul li { line-height: 30px; }
	</style>
</head>
<body>
	<div style="float: left; margin-left: 10px;">
		<div>Class:
			<select id="classes">
				<option value="-1">All</option>
				<%=ViewData["options"]%>
			</select>
			<input type="button" name="" value="Filter" onclick="filter()" />
		</div>
		<table id="logList" style="width: 530px;">
			<thead>
				<tr>
					<th style="width: 90px">
						<a href="#" onclick="AddNew()">Add</a>
					</th>
					<th style="">Solution name</th>
				</tr>
				<tr id='logList_bt' style="display: none">
					<td>
						<a href="/Admini/SolutionEdit?id={ID}&classID={ClassID}">Modify </a>
						<a href="#" onclick="deleteSolution('{ID}')">Delete</a></td>
					<td>{Title}</td>
				</tr>
			</thead>
		</table>
	</div>
	<script type="text/javascript">
		function AddNew() {
			location.href("/Admini/SolutionEdit?classID=" + $("#classes :selected").val())
		}
		var classID = 0;
		$(document).ready(function () {
			$("#logList").treeTable({
				treeColumn: -1,
				key: "ID",
				bind: {
					templateID: "#logList_bt",
					ajaxPara: { classID: $("#classes :selected").val() },
					url: "/Admini/GetAllSolutions",
					ajaxSuccess: function (re) { }
				}
			});
		});

		function deleteSolution(id) {
			if (confirm("Confirm delete this solution message?")) {
				$.ajax({
					cache: false,
					data: { id: id },
					url: "/Admini/DeleleSolution",
					success: function (aaa) {
						if (aaa) {
							alert("Solution message has deleted");
							$("#logList").ttGetItem(id).ttRemove();
						}
					}
				});
			}
		}

		function filter() {

			$("#logList").treeTable({
				treeColumn: -1,
				key: "ID",
				bind: {
					templateID: "#logList_bt",
					ajaxPara: { classID: $("#classes :selected").val() },
					url: "/Admini/GetAllSolutions",
					ajaxSuccess: function (re) { }
				}
			});

		}
	</script>
</body>
</html>
